package co.yixiang.modules.quartz.task;

import co.yixiang.modules.shop.service.YxInvestOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 支付超时订单释放定时器
 *
 * @author frq
 * @date 2020-7-13
 */
@Component
@Slf4j
public class PaymentTimeoutReleaseTimer {

    @Autowired
    private YxInvestOrderService yxInvestOrderService;

    public void run(){
        List<Map<String,Integer>> listGoods=yxInvestOrderService.findListGoods(1,"pay_timeout");
        for (Map<String,Integer> map:listGoods) {
            try {
                yxInvestOrderService.updatePaymentTimeout(map);
            }catch (Exception e){
                log.info("订单号:"+map.get("id")+"超时释放异常",e.getMessage());
            }

        }
    }

}
